package com.yinkgh.datasource;


/**
 * 数据库切换的工具类
 * @author yinkgh
 */
public class DataSourceContextHolder {
	
	private static final ThreadLocal<String> THREAD_DATA_SOURCE = new ThreadLocal<String>();  
	  
	public static String getDataSource() {
		return THREAD_DATA_SOURCE.get();
	}

	public static void setDataSource(String dataSource) {
		System.out.println("********************设置数据源为：" + dataSource);
		THREAD_DATA_SOURCE.set(dataSource);
	}

	public static void clearDataSource() {
		THREAD_DATA_SOURCE.remove();
	}
}
